package com.zjm.find.service.impl;


import com.zjm.find.dao.SuggestionMapper;
import com.zjm.find.dao.UserManageMapper;
import com.zjm.find.dao.UserMapper;
import com.zjm.find.pojo.Suggestion;
import com.zjm.find.pojo.User;
import com.zjm.find.pojo.UserManage;
import com.zjm.find.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;


/**
 * TODO
 *
 * @Author 涛涛
 * @Create 2020/2/21
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private UserManageMapper userManageMapper;

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private SuggestionMapper suggestionMapper;


    @Override
    public List selectManagers(int suid, String password) {
//        String password1 = DigestUtils.md5DigestAsHex(password.getBytes());
        return userManageMapper.selectManagers(suid, password);
    }

    @Override
    public boolean updateManageInfoBySuid(UserManage userManage) {
        return userManageMapper.updateManageInfoBySuid(userManage) == 1 ? true : false;
    }

    @Override
    public List selectAllManage(UserManage userManage) {
        return userManageMapper.selectAllManage(userManage);
    }

    @Override
    public boolean addManager(UserManage userManage) {
        return userManageMapper.addManage(userManage) == 1 ? true : false;
    }

    @Override
    public List allUser(User user) {
        return userMapper.allUser(user);
    }

    @Override
    public List selectSuggestion() {
        return suggestionMapper.selectSuggestion();
    }

    @Override
    public boolean deleteSuggestion(Suggestion suggestion) {
        return suggestionMapper.deleteSuggestion(suggestion)== 1 ? true : false;
    }


}
